
<!--  -->
<template>
    <div class="app-container">
        <div>
            <router-link to="/store/storeList">
                <el-button type="text" icon="el-icon-arrow-left" size="default">返回</el-button>
            </router-link>
        </div>
        <el-form :inline="true" size="small">
            <el-form-item label="订单编号">
                <el-input v-model="kwd1" placeholder="请输入订单编号" size="small"></el-input>
            </el-form-item>
            <el-form-item label="状态">
                <el-select v-model="kwd2" placeholder="订单状态" clearable filterable @change>
                    <el-option label="已付款" value="pay"></el-option>
                    <el-option label="已发货" value="send"></el-option>
                    <el-option label="已收货" value="check"></el-option>
                    <el-option label="交易完成" value="success"></el-option>
                    <el-option label="未核销" value="no-write"></el-option>
                    <el-option label="已核销" value="write"></el-option>
                </el-select>
            </el-form-item>

            <el-button icon="el-icon-search" type="primary" size="small" @click>搜索</el-button>
            <el-button icon="el-icon-refresh" size="small" @click>重置</el-button>
            <el-button icon="el-icon-edit" type="primary" size="small" @click>导出</el-button>

            <el-button class="ref-btn" icon="el-icon-refresh" circle @click></el-button>
        </el-form>
        <el-table :data="tableData" border stripe>
            <el-table-column type="selection" width="60" align="center"></el-table-column>

            <template v-for="(i, index) in columns">
                <el-table-column
                    v-if="index == 4"
                    :key="i.id"
                    :label="i.label"
                    align="center"
                    :width="i.width"
                >
                    <template slot-scope="scope">
                        <div>{{ scope.row.status }}核销</div>
                    </template>
                </el-table-column>

                <el-table-column
                    v-else
                    :prop="i.data"
                    :key="i.id"
                    :label="i.label"
                    align="center"
                    :width="i.width"
                />
            </template>
            <el-table-column align="center" label="操作">
                <template slot-scope="scope">
                    <el-button type="text" icon="el-icon-edit" @click="edit(scope.row)"
                        >编辑</el-button
                    >
                    <el-button
                        type="text"
                        icon="el-icon-delete"
                        style="color: #f66"
                        @click="del(scope.$index, scope.row)"
                        >删除</el-button
                    >
                </template>
            </el-table-column>
        </el-table>
        <!-- 分页 -->
        <div class="page">
            <el-pagination
                @size-change="sizeChange"
                @current-change="currentChange"
                :current-page.sync="page"
                :page-sizes="[20, 40, 80, 100]"
                :page-size="limit"
                layout="total, sizes, prev, pager, next, jumper"
                :total="total"
                background
            ></el-pagination>
        </div>

        <!-- 对话框 -->
        <el-dialog
            :title="dialogTitle"
            :visible.sync="showDialog"
            width="50%"
            @close="showDialog = false"
        >
            <div class="dBox">
                <div class="dList">
                    <div class="dLabel">订单编号</div>
                    <div class="dCon">0012021032611207263</div>
                </div>
                <div class="dList">
                    <div class="dLabel">订单分类</div>
                    <div class="dCon">课程</div>
                </div>
                <div class="dList">
                    <div class="dLabel">下单手机号</div>
                    <div class="dCon">17678029384</div>
                </div>
                <div class="dList">
                    <div class="dLabel">订单总额</div>
                    <div class="dCon">￥193</div>
                </div>
                <div class="dList">
                    <div class="dLabel">订单状态</div>
                    <div class="dCon">已付款</div>
                </div>
                <div class="dList">
                    <div class="dLabel">订单进度</div>
                </div>
                <div style="width: 500px; margin: 0 auto">
                    <el-steps :space="200" :active="2" align-center>
                        <el-step title="已付款"></el-step>
                        <el-step title="待发货"></el-step>
                        <el-step title="待收货"></el-step>
                        <el-step title="待确认"></el-step>
                    </el-steps>
                </div>
            </div>

            <span slot="footer">
                <el-button @click="showDialog = false">取消</el-button>
                <el-button type="primary" @click>确定</el-button>
            </span>
        </el-dialog>
    </div>
</template>

<script>
import { getArticle } from "@/api/article";
export default {
    name: "slider",
    data () {
        return {
            kwd1: "",
            kwd2: "",
            page: 1,
            limit: 10,
            total: 10,
            queryId: "",
            dialogTitle: "创建",
            showDialog: false,
            form: {
                subTime: "",
                subShop: "",
                subCount: "",
                subPayment: "",
            },
            options: [
                {
                    value: 1,
                    label: "支付方式1",
                },
                {
                    value: 2,
                    label: "支付方式2",
                },
            ],
            tableData: [
                {
                    id: "1",
                    type: "2021-02-21",
                    phone: "生日模板",
                    total: 1,
                    status: 20,
                },
                {
                    id: "2",
                    type: "2021-02-21",
                    phone: "生日模板",
                    total: 2,
                    status: 30,
                },
                {
                    id: "3",
                    type: "2021-02-21",
                    phone: "生日模板",
                    total: 1,
                    status: 40,
                },
            ],

            columns: [
                { key: 0, label: `订单编号`, data: "id", width: "80" },
                { key: 1, label: `订单类型`, data: "type" },
                { key: 2, label: `下单手机号`, data: "phone" },
                { key: 3, label: `订单总额`, data: "total" },
                { key: 3, label: `订单状态`, data: "status" },
            ],
            artQuery: {
                id: "1",
            },
        };
    },
    created () {
    },
    methods: {
        add () {
            this.form = {
                subTime: "",
                subShop: "",
                subCount: "",
                subPayment: 1,
            };
            this.showDialog = true;
        },
        edit (i) {
            this.form = {
                subTime: i.bTime,
                subShop: i.shop,
                subCount: i.bCount,
                subPayment: i.payment,
            };
            this.showDialog = true;
        },
        del (i, d) {
            this.$confirm("确认删除所选数据？", "确认删除", {
                confirmButtonText: "确认",
                cancelButtonText: "取消",
                type: "warning",
            })
                .then(() => {
                    this.tableData.splice(i, 1);
                })
                .catch(() => { });
        },
        sizeChange () { },
        currentChange () { },
    },
};
</script>
<style scoped>
.slideImg {
    width: 140px;
}
</style>
